using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerJumpState : PlayerState
{
    public PlayerJumpState(Player _player, PlayerStateMachine _stateMachine, string _animBoolName) : base(_player, _stateMachine, _animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
        player.rb.velocity = new Vector2(player.rb.velocity.x, player.jumpForce);
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void update()
    {
        base.update();
        if (player.IsHeadDected() == false && player.IsWallDected() && player.IsMiddleDected())
        {
            Debug.Log("hugging״̬");
            stateMachine.ChangeState(player.huggingState);
        }
        if (player.rb.velocity.y < 0 )
        {
            stateMachine.ChangeState(player.airState);
        }
    }
}
